/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author niit
 */
@Entity
@Table(name = "fl_studycenter")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FlStudycenter.findAll", query = "SELECT f FROM FlStudycenter f"),
    @NamedQuery(name = "FlStudycenter.findByCenterid", query = "SELECT f FROM FlStudycenter f WHERE f.centerid = :centerid"),
    @NamedQuery(name = "FlStudycenter.findByName", query = "SELECT f FROM FlStudycenter f WHERE f.name = :name"),
    @NamedQuery(name = "FlStudycenter.findByLocation", query = "SELECT f FROM FlStudycenter f WHERE f.location = :location")})
public class FlStudycenter implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "centerid")
    private Integer centerid;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 200)
    @Column(name = "name")
    private String name;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 500)
    @Column(name = "location")
    private String location;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "centerid")
    private List<FlStudent> flStudentList;

    public FlStudycenter() {
    }

    public FlStudycenter(Integer centerid) {
        this.centerid = centerid;
    }

    public FlStudycenter(Integer centerid, String name, String location) {
        this.centerid = centerid;
        this.name = name;
        this.location = location;
    }

    public Integer getCenterid() {
        return centerid;
    }

    public void setCenterid(Integer centerid) {
        this.centerid = centerid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @XmlTransient
    public List<FlStudent> getFlStudentList() {
        return flStudentList;
    }

    public void setFlStudentList(List<FlStudent> flStudentList) {
        this.flStudentList = flStudentList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (centerid != null ? centerid.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FlStudycenter)) {
            return false;
        }
        FlStudycenter other = (FlStudycenter) object;
        if ((this.centerid == null && other.centerid != null) || (this.centerid != null && !this.centerid.equals(other.centerid))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.FlStudycenter[ centerid=" + centerid + " ]";
    }
    
}
